Add shared validator access validation and force flag - #211
Conversation
|
Hi Team 👋 I’ve opened this PR to add the shared validator access validation logic and the When you have some time, I’d really appreciate a review and any feedback. Thanks! |
karl-dz
left a comment
There was a problem hiding this comment.
Thank you for your contribution. I left a few comments
|
Thanks a lot for the detailed review, @karl-dz ! I’ve updated the PR to:
|
There was a problem hiding this comment.
Very nice, thank you for making those changes.
If you can also add an entry to the CHANGELOG.md file in crates/solana-cli like how the other entries are (you can put it under "Unreleased"), I can go ahead and approve this guy after the checks pass
|
Hi @karl-dz , Please let me know if you’d like any tweaks to the wording or placement. |
420e06f and 420e06f can be removed if you rebase with main. Assuming the remote for this repo is git fetch upstream
git rebase upstream/mainYou mind giving that a try? There may be a merge conflict at 94fa4c4 in the changelog when you do this, but that should be easy to resolve. Let me know if you have any issues |
|
Hi @karl-dz I’ve fixed the formatting issues ( I also tried running
This seems related to the local fork / config account rather than the new validator access validation logic, but I’m happy to adjust the script if you’d like me to change how the test is set up. |
I'll have to put up a PR to remove that shell script. Try to follow the workflow found in local-validator.yml: https://github.com/RedaRahmani/doublezero-offchain/blob/feat/passport-validator-access-validation/.github/workflows/local-validator.yml#L37-L42. Let me know if you have an issue using |
|
Hi @karl-dz , Thanks a lot for the detailed review! I’ve re-run sh/test_doublezero_solana_clean.sh on my side following the With that setup:
The part that now fails without any extra flags is
because the new validation correctly complains that the local validator is not an active staked validator, so the
then fails with Failed to If I add the new I’m happy to: update drop the shell script and rely purely on the local-validator.yml workflow as you suggested. Let me know which option you’d prefer and I’ll update the PR accordingly. |
Let me try something locally. Will keep you updated. |
We just merged a fix to the leader schedule evaluation. Can you rebase with the latest main? I just rebased with main locally in your branch and it seems to work now (so no need to pass in |
Actually, I am mistaken. If you happen to rebase after this PR gets merged, CI will fail again. But that is because the default number of epochs is 2. If you add another hidden optional argument for request access (something like |
|
Hi @karl-dz , Haha, no worries at all , I’m happy to be a good sport about it 😄 I’ll add a hidden I’m away from my desk right now, but I’ll make these changes once I’m back home and will let you know when the updates are pushed. |
Adding this argument to the prepare command as well would be good, too, if you can. And since there is so much overlap with arguments, it may also make sense to have a shared commands struct in the submodule you added and to flatten that struct into prepare and request. Up to you, though. Thank you |
|
Hi @karl-dz , I’ve implemented the changes you suggested
Please let me know if anything looks off or if you’d like me to adjust anything further. |
Nice. I took quick look through the changes and have a few suggestions.
This change looks like it is almost ready to ship. Good job with everything so far. |
…IOUS_LEADER_EPOCHS default
|
Hi @karl-dz , Thanks a lot for the review and the kind words! I’ve updated the PR based on your suggestions: Switched the command argument to Option and now use Cleaned up the history by dropping the extra merge commits and rebasing on top of the latest main like before. Please let me know if you’d like any further tweaks. |
karl-dz
left a comment
There was a problem hiding this comment.
Thank you for addressing this issue!
|
Thank you so much for the guidance and quick reviews, really appreciate it! |
Of course. We usually track our issues here, so feel free to continue contributing: https://github.com/malbeclabs/doublezero/issues. We appreciate the help |
…blezero-offchain#211) ## Summary of Changes This PR implements the behavior described in malbeclabs/doublezero-offchain#155 for the passport CLI: - Extracts the validator access validation (gossip + leader scheduler checks for primary and backup validators) into a shared helper module: `crates/solana-cli/src/command/passport/access_validation.rs`. - Refactors `prepare-validator-access` to use this shared helper, preserving the existing output and `--force` semantics. - Extends `request-validator-access` to: - print the same cluster / validator info as `prepare-validator-access`, - run the same validation checks before PDA/signature/tx submission, and - support a new `-f/--force` flag so operators can override validation while still seeing the errors. - Wires the new module into `crates/solana-cli/src/command/passport/mod.rs`. With this change, `request-validator-access` now mirrors the validation behavior of `prepare-validator-access`: - Without `--force`: validation errors stop execution before the transaction is sent. - With `--force`: validation errors are printed as warnings and the transaction is still submitted. ## Testing Verification I ran the CLI crate tests locally: ```bash cargo test -p doublezero-solana-cli
Summary of Changes
This PR implements the behavior described in #155 for the passport CLI:
primary and backup validators) into a shared helper module:
crates/solana-cli/src/command/passport/access_validation.rs.prepare-validator-accessto use this shared helper, preserving theexisting output and
--forcesemantics.request-validator-accessto:prepare-validator-access,-f/--forceflag so operators can override validation whilestill seeing the errors.
crates/solana-cli/src/command/passport/mod.rs.With this change,
request-validator-accessnow mirrors the validation behaviorof
prepare-validator-access:--force: validation errors stop execution before the transaction is sent.--force: validation errors are printed as warnings and the transactionis still submitted.
Testing Verification
I ran the CLI crate tests locally:
cargo test -p doublezero-solana-cli